<div class="panel panel-default">
    <div class="panel-body">
        <div class="row">
            <form action="" method="get">
                <div class="col-md-3">
                    <div class="input-group">
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="input-group">
                        <span class="input-group-addon"> 日志级别</span>
                        <select class="form-control" name="level">
                            <option value="">全部</option>
                            <option value="7">DEBUG</option>
                            <option value="6">INFO</option>
                            <option value="4">WARNING</option>
                            <option value="3">ERROR</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="input-group">
                        <span class="input-group-addon"> 用户名 </span>
                        <input class="form-control" name="username" type="text" value="{{.username}}" placeholder="用户名">
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="input-group">
                        <input class="form-control" name="message" type="text" value="{{.message}}" placeholder="描述">
                        <span class="input-group-btn">
				              <button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button>
				            </span>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="table-responsive">
        <table class="table table-bordered">
            <thead>
            <tr>
                <th class="w7p">ID</th>
                <th class="w10p">级别</th>
                <th class="w9p">用户</th>
                <th>描述</th>
                <th class="w15p">动作</th>
                <th class="w10p">IP</th>
                <th class="w15p">时间</th>
            </tr>
            </thead>
            <tbody>
            {{range $logAction := .logActions}}
                <tr>
                    <td class="center">{{$logAction.log_id}}</td>
                    <td class="center">
                        {{if eq $logAction.level "3"}}<span class="label label-danger">ERROR</span>{{end}}
                        {{if eq $logAction.level "4"}}<span class="label label-warning">WARNING</span>{{end}}
                        {{if eq $logAction.level "6"}}<span class="label label-info">INFO</span>{{end}}
                        {{if eq $logAction.level "7"}}<span class="label label-debug">DEBUG</span>{{end}}
                    </td>
                    <td class="center">{{$logAction.username}}</td>
                    <td><a name="info" data-link="/log/actionInfo?log_id={{$logAction.log_id}}">{{$logAction.message}}</a></td>
                    <td>{{$logAction.controller}}/{{$logAction.action}}</td>
                    <td class="center">{{$logAction.ip}}</td>
                    <td class="center">
                        {{dateFormat $logAction.create_time "Y-m-d H:i:s"}}
                    </td>
                </tr>
            {{end}}
            </tbody>
        </table>
    </div>
    <div class="panel-footer">
        {{template "paginator/default.html" .}}
    </div>
</div>
<script type="text/javascript">
    $(function () {
        Layers.bindIframe("[name='info']", "日志详细信息", "400px", "800px")
        $("select").val({{.level}})
    });
</script>